package com.gc.business.service.impl;

import java.util.List;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.gc.common.utils.StringUtils;
import org.springframework.stereotype.Service;
import com.gc.business.mapper.UpkeepTemplateMapper;
import com.gc.business.domain.UpkeepTemplate;
import com.gc.business.service.IUpkeepTemplateService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;

/**
 * 电梯保养模板 服务层实现
 * 
 * @author hruiyan
 * @date 2020-11-18
 */
@Slf4j
@Service
public class UpkeepTemplateServiceImpl extends ServiceImpl<UpkeepTemplateMapper, UpkeepTemplate> implements IUpkeepTemplateService {

    @Override
    public List<UpkeepTemplate> list(UpkeepTemplate upkeepTemplate){
        LambdaQueryWrapper<UpkeepTemplate> wrapper = new LambdaQueryWrapper<>();
        if(upkeepTemplate != null){
            if(StringUtils.isNotEmpty(upkeepTemplate.getTemplateId())){
                wrapper.eq(UpkeepTemplate::getTemplateId, upkeepTemplate.getTemplateId());
            }
            if(StringUtils.isNotEmpty(upkeepTemplate.getCompanyId())){
                wrapper.eq(UpkeepTemplate::getCompanyId, upkeepTemplate.getCompanyId());
            }
            if(StringUtils.isNotEmpty(upkeepTemplate.getTemplateName())){
                wrapper.like(UpkeepTemplate::getTemplateName, upkeepTemplate.getTemplateName());
            }
            if(StringUtils.isNotEmpty(upkeepTemplate.getElevatorType())){
                wrapper.eq(UpkeepTemplate::getElevatorType, upkeepTemplate.getElevatorType());
            }
            if(StringUtils.isNotEmpty(upkeepTemplate.getUpkeepType())){
                wrapper.eq(UpkeepTemplate::getUpkeepType, upkeepTemplate.getUpkeepType());
            }
            if(StringUtils.isNotEmpty(upkeepTemplate.getCreateBy())){
                wrapper.eq(UpkeepTemplate::getCreateBy, upkeepTemplate.getCreateBy());
            }
            if(StringUtils.isNotEmpty(upkeepTemplate.getCreateTime())){
                wrapper.eq(UpkeepTemplate::getCreateTime, upkeepTemplate.getCreateTime());
            }
            if(StringUtils.isNotEmpty(upkeepTemplate.getUpdateBy())){
                wrapper.eq(UpkeepTemplate::getUpdateBy, upkeepTemplate.getUpdateBy());
            }
            if(StringUtils.isNotEmpty(upkeepTemplate.getUpdateTime())){
                wrapper.eq(UpkeepTemplate::getUpdateTime, upkeepTemplate.getUpdateTime());
            }
            if(StringUtils.isNotEmpty(upkeepTemplate.getRemark())){
                wrapper.eq(UpkeepTemplate::getRemark, upkeepTemplate.getRemark());
            }
        }
        return baseMapper.selectList(wrapper);
    }
}
